Function Reference

_IEAttach

Attach to the first existing instance of Internet Explorer where the search string sub-string matches based on the selected mode.

#include <IE.au3>
_IEAttach ( $s_string [, $s_mode = "Title"] )

 

Parameters

$s_string String to search for (for "embedded" or "dialogbox", use Title sub-string or HWND of window)
$s_mode Optional: specifies search mode
Title = (Default) sub-string of main document title
WindowTitle = sub-string of full window title (instead of document title)
URL = sub-string or url of the current page
Text = sub-string in text from the body of the current page
HTML = sub-string in html from the body of the current page
HWND = hwnd of the browser window
Embedded = title sub-string or hwnd of of the window embedding the control
DialogBox = title sub-string or hwnd of modal/modeless dialogbox

 

Return Value

Success: Returns an object variable pointing to the IE Window Object
Failure: Returns 0 and sets @ERROR
@Error: 0 ($_IEStatus_Success) = No Error
5 ($_IEStatus_InvalidValue) = Invalid Value
7 ($_IEStatus_NoMatch) = No Match
@Extended: Contains invalid parameter number

 

Remarks

_IEAttach provides the "DialogBox" parameter to attach to modal and modeless dialogs created by the browser. It is important to note that not all dialogs created through browser interaction can be attached to and controlled in this way. Many of these dialogs are actually standard windows and can be controlled through the traditional AutoIt window functions. A reliable way to tell the difference between these types of windows is to use the "AutoIt Window Info" tool to examine it -- if the window contains a control called "Internet Explorer_Server1" then you can attach to it with this function, if it does not it is a standard window and traditional AutoIt windows functions must be used to control it.

The "embedded" option must be used to attach to HyperTextApplication (.hta) windows.

 

Related

_IECreate, _IECreateEmbedded, _IEQuit

 

Example


; *******************************************************
; Example 1 - Attach to a browser with "AutoIt" in its title, display the URL
; *******************************************************
;
#include <IE.au3>
$oIE = _IEAttach ("AutoIt")
MsgBox(0, "The URL", _IEPropertyGet ($oIE, "locationurl"))

; *******************************************************
; Example 2 - Attach to a browser with "The quick brown fox"
;               in the text of it's top-level document
; *******************************************************
;
#include <IE.au3>
$oIE = _IEAttach ("The quick brown fox", "text")

; *******************************************************
; Example 3 - ; Attach to a browser control embedded in another window
; *******************************************************
;
#include <IE.au3>
$oIE = _IEAttach ("A Window Title", "embedded")